package com.dletc.dao.Impl;

import com.dletc.dao.DishDao;
import com.dletc.domain.Dish;
import org.junit.Test;

import java.util.ArrayList;
import java.util.List;

public class DishTest {
    DishDao dishDao = new DishDaoImpl();

    //增加测试
    @Test
    public void AddDish(){
        Dish dish = new Dish("香辣红烧牛肉面",24);
        dishDao.AddDish(dish);
    }

    //通过ID删数据测试
    @Test
    public void deleteById(){
        int DishID = 2;
        dishDao.deleteById(DishID);
    }


    //查询整个菜品表
    @Test
    public void GetAll(){
        List<Dish> list = dishDao.GetAll();
        for (Dish dish : list) {
            System.out.println(dish);
        }
    }

    //根据ID查一个菜品信息
    @Test
    public void GetByID(){
        int DishID = 1;
        Dish dish = dishDao.GetByID(DishID);
        System.out.println(dish);
    }

    //根据ID修改菜品价格
    @Test
    public void UpdateMoney(){
        int DishID = 1;
        int DishMoney = 15;
        dishDao.UpdateMoney(DishID,DishMoney);
    }
}
